import Vue from 'vue'
import Vuex from 'vuex'

import VuexPersist from 'vuex-persist'

import createPersistedState from 'vuex-persistedstate'

const vuexLocal = new VuexPersist({
    storage: window.localStorage //可选，sessionStorage/indexDB  // 你的储存方式
  });

  Vue.use(Vuex); export default new Vuex.Store({
    plugins:[createPersistedState(),] ,
    state: {
        putaway:[],
        submitAway:[]
    },
    mutations: {
        setM(){
        },
        setN(item,zhi){
            this.state.putaway.push(zhi)
        },
        setS(item,zhi){
            this.state.putaway.splice(zhi,1)
        },
        setK(){
            this.state.putaway.splice(0)
        },
        setC(item,zhi){
                if(this.state.submitAway.indexOf(zhi)==-1){
                    this.state.submitAway.push(zhi)
                }
            console.log(this.state.submitAway)
        },
        delC(item,zhi){
            this.state.submitAway.splice(zhi,1)
        },
        delCS(){
            this.state.submitAway.splice(0)
        },
    },  


})
// const store = new Vuex.Store({
//     state,
//     getters,
//     mutations,
//     actions,
//     plugins: [vuexLocal.plugin]
//   });